﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace BugTracker.BusinessLogic.Attachments
{
    public class AttachmentMapper : IAttachmentMapper
    {
        #region IAttachmentMapper Members

        public DataAccess.Data.Attachment Map(BusinessEntities.Entities.Attachments.Attachment value)
        {
            DataAccess.Data.Attachment result = new DataAccess.Data.Attachment();
            result.AttachmentID = value.AttachmentID;
            result.WorkLogID = value.WorkLogID;
            result.Name = value.Name;
            result.ContentType = value.ContentType;
            result.ContentLength = value.ContentLength;
            result.ContentData = value.ContentData;
            result.IsActive = value.IsActive;
            result.IsDeleted = value.IsDeleted;
            result.RowGuid = value.RowGuid;
            result.CreatedOn = value.CreatedOn;
            result.ModifiedOn = value.ModifiedOn;
            return result;
        }

        public BusinessEntities.Entities.Attachments.Attachment Map(DataAccess.Data.Attachment value)
        {
            BusinessEntities.Entities.Attachments.Attachment result = 
                new BusinessEntities.Entities.Attachments.Attachment();
            result.AttachmentID = value.AttachmentID;
            result.WorkLogID = value.WorkLogID;
            result.Name = value.Name;
            result.ContentType = value.ContentType;
            result.ContentLength = value.ContentLength;
            result.ContentData = value.ContentData;
            result.IsActive = value.IsActive;
            result.IsDeleted = value.IsDeleted;
            result.RowGuid = value.RowGuid;
            result.CreatedOn = value.CreatedOn;
            result.ModifiedOn = value.ModifiedOn;
            return result;
        }

        public void Map(DataAccess.Data.Attachment result, BusinessEntities.Entities.Attachments.Attachment value, bool includeKey = false)
        {
            if (includeKey)
            {
                value.AttachmentID = result.AttachmentID;
            }
            value.WorkLogID = result.WorkLogID;
            value.Name = result.Name;
            value.ContentType = result.ContentType;
            value.ContentLength = result.ContentLength;
            value.ContentData = result.ContentData;
            value.IsActive = result.IsActive;
            value.IsDeleted = result.IsDeleted;
            value.RowGuid = result.RowGuid;
            value.CreatedOn = result.CreatedOn;
            value.ModifiedOn = result.ModifiedOn;
        }

        public void Map(BusinessEntities.Entities.Attachments.Attachment result, DataAccess.Data.Attachment value, bool includeKey = false)
        {
            if (includeKey)
            {
                value.AttachmentID = result.AttachmentID;
            }
            value.WorkLogID = result.WorkLogID;
            value.Name = result.Name;
            value.ContentType = result.ContentType;
            value.ContentLength = result.ContentLength;
            value.ContentData = result.ContentData;
            value.IsActive = result.IsActive;
            value.IsDeleted = result.IsDeleted;
            value.RowGuid = result.RowGuid;
            value.CreatedOn = result.CreatedOn;
            value.ModifiedOn = result.ModifiedOn;
        }

        #endregion
    }
}
